package com.iflytek.jobs.admin.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.iflytek.jobs.service.domain.ResumeDelivery;
import com.iflytek.jobs.service.service.IResumeDeliveryService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 简历指导指派Controller
 * 
 * @author chenhs
 * @date 2025-08-18
 */
@RestController
@RequestMapping("/jobs/resumede")
public class ResumeDeliveryController extends BaseController
{
    @Autowired
    private IResumeDeliveryService resumeDeliveryService;

    /**
     * 查询简历指导指派列表
     */
    @PostMapping("/list")
    public TableDataInfo list(@RequestBody ResumeDelivery resumeDelivery)
    {
        startPage(true);
        List<ResumeDelivery> list = resumeDeliveryService.selectResumeDeliveryList(resumeDelivery);
        return getDataTable(list);
    }

    /**
     * 导出简历指导指派列表
     */
    @PreAuthorize("@ss.hasPermi('jobs:resumede:export')")
    @Log(title = "简历指导指派", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ResumeDelivery resumeDelivery)
    {
        List<ResumeDelivery> list = resumeDeliveryService.selectResumeDeliveryList(resumeDelivery);
        ExcelUtil<ResumeDelivery> util = new ExcelUtil<ResumeDelivery>(ResumeDelivery.class);
        util.exportExcel(response, list, "简历指导指派数据");
    }

    /**
     * 获取简历指导指派详细信息
     */
    @GetMapping(value = "/{redId}")
    public AjaxResult getInfo(@PathVariable("redId") Long redId)
    {
        return success(resumeDeliveryService.selectResumeDeliveryByRedId(redId));
    }

    /**
     * 新增简历指导指派
     */
    @Log(title = "简历指导指派", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ResumeDelivery resumeDelivery)
    {
        return toAjax(resumeDeliveryService.insertResumeDelivery(resumeDelivery));
    }

    /**
     * 修改简历指导指派
     */
    @Log(title = "简历指导指派", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ResumeDelivery resumeDelivery)
    {
        resumeDelivery.setUpdateBy(getUsername());
        return toAjax(resumeDeliveryService.updateResumeDelivery(resumeDelivery));
    }

    /**
     * 删除简历指导指派
     */
    @Log(title = "简历指导指派", businessType = BusinessType.DELETE)
	@DeleteMapping("/{redIds}")
    public AjaxResult remove(@PathVariable Long[] redIds)
    {
        return toAjax(resumeDeliveryService.deleteResumeDeliveryByRedIds(redIds));
    }
}
